/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/////////////////////////////////////////////////////////////////////////////

package sheep.model;

/////////////////////////////////////////////////////////////////////////////

import java.awt.Image;
import java.awt.Toolkit;
import java.util.Calendar;
import java.util.LinkedList;

/////////////////////////////////////////////////////////////////////////////

/**
 *
 * @author geek
 * 
 * Classe representant un travailleur repertorie
 */
public class Worker {

  /////////////////////////////////////////////////////////////////////////////
  private static int number = 1;
  private int id;
  // Nom de l'utilisateur
  private String firstName;
  private String lastName;
  private String job;
  public static final int workerTabLength = 4; // Longueur du tab retourné par getWorker
  // Image associee
  private Image pictures;
  private String picturesURL;
  // Date de Naissance
  private Calendar birthDate;
  // Adresse
  private String adresse;
  // NIP
  private String postCode;
  // Ville
  private String town;
  
  // List de projet
  private LinkedList<Task> taskList= new LinkedList<Task>();
  //Liste de groupe
  private LinkedList<WorkGroup> groupList= new LinkedList<WorkGroup>();

  /////////////////////////////////////////////////////////////////////////////
  
  // Getters & Setters
  // Nom
  public String getFirstName() {return firstName;}
  public void   setFirstName(String firstName) {this.firstName = firstName;}
  
  public String getLastName() {return lastName;}
  public void   setLastName(String lastName) {this.lastName = lastName;}
  
  public String getJob() { return job; }
  public void   setJob(String job) { this.job = job; }
  
  public Object[] getWorkerTab() { return new Object[]{id, firstName, lastName, job}; }
  
  // Image
  public String getPicturesURL() {return picturesURL;}
  public Image getPictures() { return pictures; }
  public void  setPictures(String pictures) { 
    this.picturesURL = pictures;
    Toolkit toolkit = Toolkit.getDefaultToolkit();
    this.pictures = toolkit.getImage(this.picturesURL);
  }  
    
    
  // Date de nAissance
  public Calendar getBirthDate() {return birthDate;}
  public void     setBirthDate(Calendar birthDate) {this.birthDate = birthDate;}
  // Adresse
  public String getAdresse() {return adresse;}
  public void   setAdresse(String adresse) {this.adresse = adresse;}
  // Code post
  public String  getPostCode() {return postCode;}
  public void setPostCode(String postCode) {this.postCode = postCode;}
  // Ville
  public String getTown() {return town;}
  public void   setTown(String town) {this.town = town;}
  
  public int getId() { return id; } 
  public void setId(int id) { this.id = id; }
  
  /////////////////////////////////////////////////////////////////////////////
  
  
  public Worker(String firstName, String lastName, Calendar birthDate,
          String adress, String postCode, String town, String picture, String job) {
    id = number;
    number++;
    setFirstName(firstName);
    setLastName(lastName);
    setBirthDate(birthDate);
    setAdresse(adress);
    setPostCode(postCode);
    setTown(town);
    setPictures(picture);
    setJob(job);
  }
}

/////////////////////////////////////////////////////////////////////////////
